<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <script src="../vue.js"></script>
  <title>Document</title>
</head>

<body>
  <div id="app">
    <!-- 页面上输入 -->
    姓: <input type="text" v-model="firstName"> <br>
    名: <input type="text" v-model="lastName"> <br>
    全名: <span>{{fullName()}}</span>
    <!-- {{}}可以写js表达式
    表达式? 语句
    表达式: b+c x===y? "a":"b"
    语句: if(){}  for(){}
    
    -->
  </div>
  <script>
    var app = new Vue({
      el: "#app",
      data: {
        num1: 8,
        num2: 10,
        firstName: "只因",
        lastName: "鸡你太美"
      },
      methods: {
        //写在模板语法的方法在vue初始化的时候会调用一次
        fullName() {
          //当你更改data中的数据,模板就会重新解析
          //console.log(123);
          return this.firstName + this.lastName;
        }
      }
    });
  </script>
</body>

</html>